#include <cstdio>
#include <cstdlib>
#include <cmath>

int main (int argc, char** argv)
{
	int t;
	int pot;
	int zero;
	int num;
	
	scanf("%d", &t);
	
	for(int i = 0; i < t; i++)
	{
		scanf("%d", &num);
		
		pot = 1;
		zero = 0;
		
		while(1)
		{
			if (num >= pow(5, pot))
			{
				zero += num / pow(5,pot);	
			}
			else
			{
				break;
			}
			
			pot++;
		}
		
		printf("%d\n",zero);
	}
	
	
	return 0;
}

